package com.jdk.demo.queue.priorityQueue;

import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.TimeUnit;

public class Consumer implements Runnable{
	PriorityBlockingQueue<PriorityEntity> queue;

    public Consumer(PriorityBlockingQueue<PriorityEntity> queue){
        this.queue = queue;
    }

    @Override
    public void run() {
    	while(true){
            try {
                System.out.println("take-- "+queue.take());
                try {
                    TimeUnit.MILLISECONDS.sleep(1000);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}